Thanks you for buying of my plugin. I hope its will give for your site more power and more fun for your clients =)
Added in v.2.1.8/1.1.8
From WooCommerce version 2.3.0 it is possible to define from which country is your customer from by IP.
This usefull functionality is using by the plugin to show your site customers currency which you decided to show them in their firts visit.
Here is all simple: add countries to the currencies using drop-down. And that is all.
For example as on the screen: USD -> selected United States -> this means that for all customers from USA will be set USD on their first vistit to your site.
If you have troubles with this feature read this article please.
This tab functionality allows you to set currency switcher as static block on the right or left side of the site page.
There is 3 skins you can use:
The plugin has shortcode which you can drop anywhere:
[woocs style=1 show_flags=1 width='300px' flag_position='right' txt_type='desc']
<?php echo do_shortcode('[woocs]'); ?>
!!Visible only if multiple mode is activated!!
Recalculate order - The plugin provides functionality to recount order to values IN the basic currency.
This feature is useful for woo statistic which doesn work in multiple mode and cant operate wit amounts in different currencies. BUT it's recommended test this feature
with clone of the site which can be created for 10 minutes by this plugin on your localhost.
This will avoid any issues related with software incompatibility!
On page orders you can find button "Recalculate all orders" which allows recalculate all orders to basic currency in one click
Change order currency - In some cases users need ability to create orders by hands. In such case they have to select currency of order.
Just look on the screens below to understand how to to that:
Depends of the plugin settings you can show your currencies drop-down as:
ddslik:
chosen:
wSelect:
simply drop-down:
as flag images:
Style #1:
Style #2:
Style #3:
Simple drop-down has CSS class woocommerce-currency-switcher which you can use in your customization if you need it.
a.woocs_flag_view_item{ display: inline-block; margin: 0 3px 3px 0; width: 50px; height: 40px; } a.woocs_flag_view_item img{ width: 100%; } a.woocs_flag_view_item_current{ opacity: 0.65; }
add_filter('woocs_price_format', 'my_woocs_custom_format', 999, 2);
function my_woocs_custom_format($format, $currency_pos)
{
return 'ANY_STRING_HERE ' . $format . ' OR_HERE';
}
add_filter('woocs_currency_data_manipulation', 'my_woocs_currency_data_manipulation');
function my_woocs_currency_data_manipulation($currencies)
{
foreach ($currencies as $key => $value)
{
if($key == 'GBP'){
$currencies[$key]['rate']=$value['rate']+0.025;
break;
}
}
return $currencies;
}
'name','rate','symbol','position','description','hide_cents','flag'Do it by your own logic and be attentive!
$value = apply_filters('woocs_exchange_value', $value);
add_filter('woocs_currency_symbols', 'my_woocs_currency_symbols', 999);
function my_woocs_currency_symbols($symbols)
{
$symbols[]="Ă";
return $symbols;
}
add_filter('woocs_drop_down_view', 'my_woocs_drop_down_view', 1);
function my_woocs_drop_down_view($default_view)
{
if ($_SERVER['REQUEST_URI'] == '/shop/clothing/happy-ninja-2/')
{
$default_view = 'chosen';
}
return $default_view;
}
$_SERVER['REQUEST_URI']
because function is_page()
doesn work there.public function woocommerce_price_format()
add_filter('woocs_price_html_tail', 'my_woocs_price_html_tail', 999);
function my_woocs_price_html_tail($price_html)
{
if (defined('DOING_AJAX') && DOING_AJAX)
{
$price_html.="Hello World 2016!!";
}
return $price_html;
}
.woocs_price_html_tail{
display: none;
}
body.single-product .woocs_price_html_tail{
display: block;
}
body.single-product .related .woocs_price_html_tail{
display: none;
}
add_filter('woocs_get_approximate_amount_text', 'my_woocs_get_approximate_amount_text', 999);
function my_woocs_get_approximate_amount_text($approx_word, $wc_price)
{
return sprintf(__('(MY-Approx-any-word. %s)'), $wc_price);
}
Here is described some plugin functionality which can be useful for site development.
global $WOOCS;
echo $WOOCS->current_currency;
global $WOOCS; $currencies=$WOOCS->get_currencies(); print_r($currencies['EUR']); print_r($currencies[$WOOCS->current_currency]);
$currencies array has next structure:
array( 'USD' => array( 'name' => 'USD', 'rate' => 1, 'symbol' => '$', 'position' => 'right', 'is_etalon' => 1, 'description' => 'USA dollar', 'hide_cents' => 0, 'flag' => '', ), 'EUR' => array( 'name' => 'EUR', 'rate' => 0.89, 'symbol' => '€', 'position' => 'left_space', 'is_etalon' => 0, 'description' => 'Europian Euro', 'hide_cents' => 0, 'flag' => '', ) );
$value = apply_filters('woocs_exchange_value', $value);
The same is possible to make by another code:
global $WOOCS;
$currencies = $WOOCS->get_currencies();
$value = $value * $currencies[$WOOCS->current_currency]['rate'];
$value = number_format($value, 2, $WOOCS->decimal_sep, '');
echo $value;
global $WOOCS;
$WOOCS->current_currency='USD';
$WOOCS->storage->set_val('woocs_current_currency', 'USD');
add_filter('woocs_drop_down_view', 'woocs_drop_down_view', 999);
function woocs_drop_down_view($view)
{
if (wp_is_mobile())
{
return 'no';
}
return $view;
}